DEVICE ANINP

0.1 Introduction

:info:Note: Input resolution specification are reporter in the hardware dossier with the describing the card (or tool).

0.2 Installation

0.2.1 Device declaration in the configuration unit

In the configuration unit, the BUS section must be declared must be declared so that they are present the hardware resources required for the implementation of the ANINP device. Must be present at least one analog input with a maximum resolution of 16 bits.
In the INTDEVICE section of the configuration unit to add the following definition:

;---------------------------------
; Devices declaration
;---------------------------------
INTDEVICE
...
<nome device>  ANINP  Tcamp  IChn  Type

dove:

<nome device>Device name
NINPKeyword that identifies the device analog input
TcampTime sampling device (1÷255 ms)
IChninput address ADC
TypeID number input type (refer to technical data sheet hardware)
:important:Warning: It is necessary that each definition are present on the same line.

0.2.2 Example

;---------------------------------
; Device declaration
;---------------------------------
INTDEVICE
AnSensor    ANINP 2   2.AI01 1

0.3 Operation

When the system is powered, the device checks the correct input type declaration use the configuration defined in the unit (Type). If the channel diagnostics ends successfully, data is upgraded on the basis of the time of sampling. NIf errors or inaccuracies are found, the st_errcfgState is set to one and the value of the variableoutbitis forced to zero. The conversion of the data output from the device (outbit), in the measure unit required for the application, is activated by means of scale factors (scaleA, scaleB e scaleC) in accordance with the formula:

outUm = (scaleA x outbit / scaleB) + scaleC

In addition to this updated release based on the sample time of the device, is available the outUmF exit, filtered using a charging time tfilter programmable (expressed in ms).

:info:This feature allows to filter any disturbances and fluctuations superimposed to the wanted
signal with the ability to customize the time of Office of the filter charge (tfilter).

0.3.1 Configuration

A single input can be managed by multiple device ANINP simultaneously, provided that the identification number of the Type entrance, inserted in the device declaration is not less; otherwise the analog input is configured as the last device declared in the configuration file.

0.4 Commands and parameters

0.4.1 Symbols used

The parameter name, condition or command is taken back to the left side of the table.

R
Indicates if its parameter or retentive state (upon initialization of the device maintains state previously defined), or the State that bears upon device initialization.
If the device does not require initialization field ' R ' indicates the value that the parameter or State accept to the card power ON.
R = Retentive
0 = Upon initialization of the device the value is forced to zero.
1 = Upon initialization of the device the value is forced to one.
- = Upon initialization of the device is presented significant value.

D
Indicates the parameter size.
F = Flag
B = Byte
W = Word
L = Long
S = Single Float

0.4.1.1 Conditions

Describes all of the conditions that is considered correct or because the command is accepted.
In some cases, limit values are specified for the acceptance of the parameter: If you any values outside the limits set, the data will still be accepted; must be provided appropriate controls of the application to ensure proper operation.
To run a command, all the conditions must be met; otherwise the command is not executed.

A
Access mode.
R = Read.
W = Write.
RW = Read / Write.

0.5 Parameters table

NAMEDRAConditionsDescription
outbitW-RNoOutput measure in bits
Value read by the input channel offset the Offset.
Valid range: 0 ÷ 32767
offsetWRRWNoOffset compensation
Offset DAC output in bits. Defines the value in bits of the correction on the analog input in order to compensate for any drift in the system.
Valid range: -32768 ÷ 32767
scaleAWRRWNoScale A
Integer A parameter to scaling formula.
Valid range: -32768 ÷ 32767
scaleBWRRWNoScale B
B parameter value used in the formula of scaling. Must be nonzero.
Valid range: -32768 ÷ 32767
scaleCWRRWNoScale C
C parameter value used in the formula of scaling.
Valid range: -32768 ÷ 32767
outUmL-RNoOutput measure in unity
Exit derived from scaling formula.
Valid range: -32768 ÷ 32767
tfilterWRRWNoFilter time
Charging time of RC filter. If filter < = Tcamp device, the filter is disable. Value expressed in ms.
Valid range: 0 ÷ 32767
outUmFL-RNoFiltered output in unity of measure
Output filtered in units.
Valid range: -32768 ÷ 32767

0.6 Tabella stati

NOMEDRACondizioniDescrizione
st_errcfgF-RNessunaConfiguration error
Segnala che è stato rilevato un errore nella configurazione dell'ingresso.
0 = Non è stato rilevato nessun errore.
1 = È stato rilevato un errore.

0.7 Limitazioni

0.7.1 Scaling

ScaleB deve essere impostato diverso da zero, in caso contrario OutUm viene forzato a 0.

0.7.2 Filtro

Il tempo di carica del filtro RC tfilter deve essere impostato maggiore o uguale al tempo di campionamento del device (Tcamp), in caso contrario viene disattivato il filtro ed il parametro OutUmF viene aggiornata con lo stesso valore di OutUm.

0.7.3 Offset

Il parametro offset viene sommato all’ingresso analogico acquisito (outbit), non viene eseguito il controllo sull‘overflow della somma.

0.7.4 Configurazione

Nel caso che un singolo canale venga gestito da più device ANINP aventi Type diversi, il compilatore non rileva errori e il canale viene impostato con l’ultimo Type dichiarato.

Una singola risorsa hardware (ogni singolo ingresso) può essere gestita da più device ANINP contemporaneamente, a condizione che il numero identificativo dell’ingresso (Type), inserito nella dichiarazione del device (file di configurazione), sia uguale; in caso contrario l’ingresso analogico viene configurato come l’ultimo device dichiarato nel file di configurazione.

0.8 Esempio applicativo

0.8.1 Unit di configurazione

;*************************************************************************************
; Nome Modulo: Ex_Aninp.CNF                 Progetto: Ex_ANINP
; Autore: QEM srl                           Data : 01/05/99
; Sistema: QMove1 / QCL3                    Libreria: 1LIB3B04
; Funzionalità: Esempio gestione ANINP      Release: 0
;------------------------------------- Note ------------------------------------------
; [1] - Applicativo di esempio per utilizzo device ANINP
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Definizione Costanti
;-------------------------------------------------------------------------------------
CONST
;-------------------------------------------------------------------------------------
; Definizione Variabili SYSTEM
;-------------------------------------------------------------------------------------
SYSTEM
slSet1   L                                ;Setpoint 1
slSet2   L                                ;Setpoint 2
;-------------------------------------------------------------------------------------
; Definizione Variabili GLOBAL
;-------------------------------------------------------------------------------------
GLOBAL
;-------------------------------------------------------------------------------------
; Definizione Variabili TIMER
;-------------------------------------------------------------------------------------
TIMER
;-------------------------------------------------------------------------------------
; Definizione DATAGROUP
;-------------------------------------------------------------------------------------
DATAGROUP
 
;-------------------------------------------------------------------------------------;
 Configurazione Bus
;-------------------------------------------------------------------------------------
BUS
    1   1CPUB   02
    2   1AI8B   00
    3   1MIXA   00
    4   .
 
;-------------------------------------------------------------------------------------
; Definizione Variabili INPUT
;-------------------------------------------------------------------------------------
INPUT
 
;-------------------------------------------------------------------------------------
; Definizione Variabili OUTPUT
;-------------------------------------------------------------------------------------
OUTPUT
ofGTSet1   F   3.OUT01                    ;Segnalazione superamento setpoint 1->
ofLTSet2   F   3.OUT02                    ;Segnalazione superamento setpoint 2<-
 
;-------------------------------------------------------------------------------------
; Dichiarazione device interni
;-------------------------------------------------------------------------------------
INTDEVICE
;Nome   Tipo   TCamp   Contatore Type
Asse    ANINP  0004    2.AI01 2
 
END

0.8.2 Gestione ANINP

;*************************************************************************************
; Nome File: TASK_00.MOD
; Progetto: EX_ANINP
; Descrizione: Gestione Posizionamento
;*************************************************************************************
 
;-------------------------------------------------------------------------------------
; Operazioni di Inizializzazione Asse
;-------------------------------------------------------------------------------------
Asse:offset = 0                                ;Tensione di offset
 
;-------------------------------------------------------------------------------------
; Fattore di scala: (scaleA * outbit / scaleB) + scaleC
; outUm minima = (4 * 0 / 8 ) + 3 = 3
; outUm massima = (4 * 4095 / 8) + 3 = 2050
;-------------------------------------------------------------------------------------
Asse:scaleA = 4                                ;Fattore di scala A
Asse:scaleB = 8                                ;Fattore di scala B
Asse:scaleC = 3                                ;Fattore di scala C
Asse:tfilter = 10                              ;Tempo del filtro di acquisizione
 
IF slSet1 EQ 0
 slSet1 = 1500
ENDIF
IF slSet2 EQ 0
 slSet2 = 300
ENDIF
;-------------------------------------------------------------------------------------
; Comparazioni sull'ingresso analogico
;-------------------------------------------------------------------------------------
; Variabili utilizzate
; slSet1 : Quota di comparazione per uscita ofGTSet1 (da impostare con Qview)
; slSet2 : Quota di comparazione per uscita ofLTSet2 (da impostare con Qview)
;-------------------------------------------------------------------------------------
 
MAIN:
  IF Asse:outUmF GT slSet1                     ;Se l'ingresso analogico è > del setpoint 1
    SETOUT ofGTSet1                            ;Attiva l'uscita ofGTSet1
  ELSE
    RESOUT ofGTSet1                            ;Disattiva l'uscita ofGTSet1
  ENDIF
 
  IF Asse:outUmF LT slSet2                     ;Se l'ingresso analogico è < del setpoint 2
    SETOUT ofLTSet2                            ;Attiva l'uscita ofLTSet2
  ELSE
    RESOUT ofLTSet2                            ;Disattiva l'uscita ofLTSet2
  ENDIF
 
  WAIT 1
  JUMP MAIN
 
END